package cn.wjzhang.middle.modules.geoLite.controller;

import cn.wjzhang.core.beans.vo.Result;
import cn.wjzhang.middle.modules.bank.beans.request.MidBankLhhListRequest;
import cn.wjzhang.middle.modules.bank.beans.vo.MidBankLhhVo;
import cn.wjzhang.middle.modules.geoLite.beans.vo.GeoLiteVo;
import cn.wjzhang.middle.modules.geoLite.service.GeoLiteService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.constraints.NotNull;

/**
 * ========================
 * GeoLite2
 *
 * @author wjzhang
 * @version v1.0
 * ========================
 * @date 2023/7/14 10:36
 */
@Slf4j
@Api(tags = "GeoLite库")
@RestController
@RequestMapping("/v1/geoLite")
public class GeoLiteController {

    @Resource
    private GeoLiteService geoLiteService;

    @ApiOperation("GeoLite2-根据ip地址查询详细信息")
    @GetMapping("/queryByIp")
    public Result<GeoLiteVo> queryPageList(HttpServletRequest request, @ApiParam(value = "ipv4地址",name = "ip") @RequestParam(name = "ip", required = false)  String ip) {
        return Result.ok(geoLiteService.getGeoLiteByIp(request, ip));
    }
}
